package com.shop.cereshop.commons.utils;

import java.util.concurrent.ThreadLocalRandom;

/**
 * @description: 随机数生成工具类
 * @author zdd
 * @date 2025/9/3 10:14
 * @version 1.0
 */
public class RandomUtil {

    /**
     * 十六进制的长整型字面量，(2的32次方),值为4294967296
     */
    public static final long DEFAULT_BOUND = 0x100000000L;

    /**
     * 生成随机的 32 位无符号整数，取值范围 [0, 4294967295]
     *
     * @return random
     */
    public static long nextLong() {
        return nextLong(DEFAULT_BOUND);
    }

    public static long nextLong(long bound) {
        return ThreadLocalRandom.current().nextLong(0, bound);
    }

    private RandomUtil() {
    }
}
